/**
 * DrivetrainSubsystem
 * 
 * This file contains all of the information relative to the Drive Train (both
 * the left and the right side).
 */

package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.templates.commands.ManualDrive;

/**
 * @author Jarrod Risley
 */

public class DrivetrainSubsystem extends Subsystem {
    
    /*
     * Global Declarations
     */
    private Victor[] motors;

    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
        
        // Command for manual driving goes HERE:
        setDefaultCommand(new ManualDrive());
        
    } // end initDefaultCommand
    
    /**
     * This method drives the robot via controller input.
     * 
     * @param speed The controller value.
     */
    
    public void drive(double speed) {
        
        for (int z = 0; z < motors.length; z++) {
            motors[z].set(speed);
        } // end for
        
    } // end drive
    
    /**
     * Moves the robot a set distance. Ideally, this method would take input
     * from encoders and move the robot in feet/meters; regardless, this 
     * method should only be used in autonomous. 
     * 
     * @param distance The distance to move (meters/feet?)
     */
    
    public void move(double distance) {
        
        // Requires calibration before this method can be filled out.
        
    } // end move
    
    /**
     * Gets the output value of the encoder.
     * 
     * @return The raw output of the encoder.
     */
    
    public int getEncoderOutput() {
        
        // Encoders must be assembled for this method to be filled out.
        return -1;
        
    } // end getEncoderO
    
    /*
     * Constructor
     */
    
    public DrivetrainSubsystem(String name, int motorOne, int motorTwo) {
        
        System.out.println("Creating DrivetrainSubsystem " + name + "...");
        
        motors = new Victor[2];
        
        motors[0] = new Victor(motorOne);
        motors[1] = new Victor(motorTwo);
        
        System.out.println(name + " has been constructed.");
        
    } // end DrivetrainSubsystem Constructor
    
}  // end DrivetrainSubsystem

